<?php 
////////////////////////////////////////////////////////////////////////////////
//   Copyright (C) ReloadCMS Development Team                                 //
//   http://reloadcms.sf.net                                                  //
//                                                                            //
//   This program is distributed in the hope that it will be useful,          //
//   but WITHOUT ANY WARRANTY, without even the implied warranty of           //
//   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                     //
//                                                                            //
//   This product released under GNU General Public License v2                //
////////////////////////////////////////////////////////////////////////////////
if (LOGGED_IN) {
$smiles=array(
  ":angry:"  => "<img src=\"/rchat/smiles/angry.gif\"",
  ":arrow:"  => "<img src=\"/rchat/smiles/arrow.gif\"",
  ":blink:"  => "<img src=\"/rchat/smiles/blink.gif\"",
  ":blush:"  => "<img src=\"/rchat/smiles/blush.gif\"",
  ":bow:"  => "<img src=\"/rchat/smiles/bow.gif\"",
  ":/" => "<img src=\"/rchat/smiles/confused.gif\"",
  ":-/" => "<img src=\"/rchat/smiles/confused.gif\"",
  "8-)" => "<img src=\"/rchat/smiles/cool1.gif\"",
  "8)" => "<img src=\"/rchat/smiles/cool1.gif\"",
  ":cry:" => "<img src=\"/rchat/smiles/cry.gif\"",
  ":devil:"  => "<img src=\"/rchat/smiles/devil.gif\"",
  ":evil:"  => "<img src=\"/rchat/smiles/evil.gif\"",
  ":evilmad:"  => "<img src=\"/rchat/smiles/evilmad.gif\"",
  ":fun:"  => "<img src=\"/rchat/smiles/fun.gif\"",
  ":-D" => "<img src=\"/rchat/smiles/grin.gif\"",
  ":D" => "<img src=\"/rchat/smiles/grin.gif\"",
  ":idea:"  => "<img src=\"/rchat/smiles/idea.gif\"",
  ":innocent:"  => "<img src=\"/rchat/smiles/innocent.gif\"",
  ":kiss:"  => "<img src=\"/rchat/smiles/kiss.gif\"",
  ":lol:"  => "<img src=\"/rchat/smiles/laugh.gif\"",
  ":look:"  => "<img src=\"/rchat/smiles/look.gif\"",
  ":love:"  => "<img src=\"/rchat/smiles/love.gif\"",
  ":ninja:"  => "<img src=\"/rchat/smiles/ninja.gif\"",
  ":no:"  => "<img src=\"/rchat/smiles/no.gif\"",
  ":-|" => "<img src=\"/rchat/smiles/noexpression.gif\"",
  ":|" => "<img src=\"/rchat/smiles/noexpression.gif\"",
  ":nugget:"  => "<img src=\"/rchat/smiles/nugget.gif\"",
  ":-O" => "<img src=\"/rchat/smiles/ohmy.gif\"",
  ":O" => "<img src=\"/rchat/smiles/ohmy.gif\"",
  ":ras:"  => "<img src=\"/rchat/smiles/ras.gif\"",
  ":rolleyes:"  => "<img src=\"/rchat/smiles/rolleyes.gif\"",
  "::)"  => "<img src=\"/rchat/smiles/rolleyes.gif\"",
  ":-(" => "<img src=\"/rchat/smiles/sad.gif\"",
  ":(" => "<img src=\"/rchat/smiles/sad.gif\"",
  ":sick:"  => "<img src=\"/rchat/smiles/sick.gif\"",
  ":slap:"  => "<img src=\"/rchat/smiles/slap.gif\"",
  ":smartass:"  => "<img src=\"/rchat/smiles/smartass.gif\"",
  ":-)" => "<img src=\"/rchat/smiles/smile1.gif\"",
  ":)" => "<img src=\"/rchat/smiles/smile1.gif\"",
  ":thumbsup:"  => "<img src=\"/rchat/smiles/thumbsup.gif\"",
  ":thumbsdown:"  => "<img src=\"/rchat/smiles/thumbsdown.gif\"",
  ":-P" => "<img src=\"/rchat/smiles/tongue.gif\"",
  ":P" => "<img src=\"/rchat/smiles/tongue.gif\"",
  ":unsure:"  => "<img src=\"/rchat/smiles/unsure.gif\"",
  ":w00t:"  => "<img src=\"/rchat/smiles/w00t.gif\"",
  ":wall:"  => "<img src=\"/rchat/smiles/wall.gif\"",
  ":wave:"  => "<img src=\"/rchat/smiles/wave.gif\"",
  ":wavecry:"  => "<img src=\"/rchat/smiles/wavecry.gif\"",
  ":weirdo:"  => "<img src=\"/rchat/smiles/weirdo.gif\"",
  ":whistle:"  => "<img src=\"/rchat/smiles/whistle.gif\"",
  ";-)" => "<img src=\"/rchat/smiles/wink.gif\"",
  ";)" => "<img src=\"/rchat/smiles/wink.gif\"",
  ":wub:"  => "<img src=\"/rchat/smiles/wub.gif\""
);

$chatwindow='
<iframe src="http://localhost/chat.php" height="400" width="80%" name="chatwindow"></iframe>
<form action="http://localhost/chat.php" method="POST" target="chatwindow" name="chatform">
<input type="hidden" name="name2" value="'.$system->user['nickname'].'">
<input type="hidden" name="site" value="add">
<input type="hidden" name="urla" value="'.$system->config['site_url'].'">
<input type="hidden" name="action" value="add">
<p align="left">'.__('Your message').': <input type="text" name="text" size="70"><input type="button" onclick="document.forms[\'chatform\'].submit(); document.chatform.elements[\'text\'].value=\'\';" value='.__('Say!').'></p>
</form>
';

$smf='';
$tmp_a=array();
foreach ($smiles as $k => $v)
{
if (!in_array($v, $tmp_a))
  $smf.= $v.'" value=":)" border="0" title="'.$k.'" onclick="document.forms[\'chatform\'].elements[\'text\'].value += \' '. $k .' \'">'."\n";
$tmp_a[]=$v;
}
$chatwindow.=$smf;
show_window(__('Chat'),$chatwindow,'center');}
else {

$chatwindow='
<iframe src="http://localhost/chat.php" height="400" width="80%" name="chatwindow"></iframe><CENTER>'.__('You must login to chatting in this room').'</CENTER>';
show_window(__('Chat'),$chatwindow,'center');
}
?>
